package rpc.client;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import rpc.aop.XiaobaibaiClientProxyFactoryBean;
import rpc.pojo.User;

@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired
    private IUserService userService;

    @Autowired
    private IDogService dogService;

    @Autowired
    private ApplicationContext applicationContext;

    @GetMapping("/{userId}")
    public User getUserItem(@PathVariable("userId")Integer userId) {
        long startTime=System.currentTimeMillis();
        User user = userService.getUserById(userId);
        System.out.println("花费时间:"+(System.currentTimeMillis()-startTime));

        String dogName = dogService.getDogName(1);
        System.out.println(dogName);

        return user;
    }

}
